package cn.damai.search.baseService.ipml;

import cn.damai.search.baseService.BaseItemTypeService;
import cn.damai.model.ItemType;
import cn.damai.search.mapper.ItemTypeMapper;
import cn.damai.util.DubboUtil;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
@Service(version = DubboUtil.VRESION,group = DubboUtil.GROUP)
public class BaseItemTypeServiceIpml implements BaseItemTypeService {

    @Autowired
    private ItemTypeMapper itemTypeMapper;

    @Override
    public ItemType getItemTypeById(@RequestParam("id") Long id){
        return itemTypeMapper.getItemTypeById(id);
    }

    @Override
    public List<ItemType>	getItemTypeListByMap(@RequestParam Map<String,Object> param){
        return itemTypeMapper.getItemTypeListByMap(param);
    }

    @Override
    public Integer getItemTypeCountByMap(@RequestParam Map<String,Object> param){
        return itemTypeMapper.getItemTypeCountByMap(param);
    }

    @Override
    public Integer qdtxAddItemType(@RequestBody ItemType itemType){
        itemType.setCreatedTime(new Date());
        return itemTypeMapper.insertItemType(itemType);
    }

    @Override
    public Integer qdtxModifyItemType(@RequestBody ItemType itemType){
        itemType.setUpdatedTime(new Date());
        return itemTypeMapper.updateItemType(itemType);
    }
}
